package com.babarus.netmonitor;

import java.util.ArrayList;

import android.util.Log;

public class PicWebModel {
	public boolean online;
	public boolean led0;
	public boolean led1;
	public boolean led2;
	public boolean led3;
	public boolean led4;
	public boolean led5;
	public boolean led6;
	public boolean led7;

	public boolean btn0;
	public boolean btn1;
	public boolean btn2;
	public boolean btn3;

	public int pot0;
	public int temp0;
	
	public PicWebModel(){
		online = false;
		led0 = false;
		led1 = false;
		led2 = false;
		led3 = false;
		led4 = false;
		led5 = false;
		led6 = false;
		led7 = false;
		btn0 = false;
		btn1 = false;
		btn2 = false;
		btn3 = false;
		
		pot0 = 0;
		
		temp0 = 0;
		
	}

	public boolean putData(ArrayList<ItemMaster> itemsList){
		online = true;
        for(int i=0;i<itemsList.size();i++){
            ItemMaster item = itemsList.get(i);
            
            if(item.getName().equalsIgnoreCase("temp0")){
            	temp0 = Integer.valueOf(item.getValue());
            }
            if(item.getName().equalsIgnoreCase("pot0")){
            	pot0 = Integer.valueOf(item.getValue());
            }
            if(item.getName().equalsIgnoreCase("btn0")){
            	if(item.getValue().equalsIgnoreCase("up")){
            		btn0 = true;
            	}else{
            		btn0 = false;            		
            	}
            }
            if(item.getName().equalsIgnoreCase("led1")){
            	if(item.getValue().equalsIgnoreCase("1")){
            		led1 = true;
            	}else{
            		led1 = false;
            	}
            }
        }
		return true;

	}
	

}
